//
//  ActivityAlertView.m
//  Bicicas
//
//  Created by UJI on 11/11/10.
//  Copyright 2010 __MyCompanyName__. All rights reserved.
//

#import "ActivityAlertView.h"

@implementation ActivityAlertView

@synthesize activityView;

- (id)initWithFrame:(CGRect)frame
{
    if ((self = [super initWithFrame:frame]))
	{
		showing = NO;
		
        self.activityView = [[[UIActivityIndicatorView alloc] initWithFrame:CGRectMake(125, 70, 30, 30)] autorelease];
		[self addSubview:activityView];
		activityView.activityIndicatorViewStyle = UIActivityIndicatorViewStyleWhiteLarge;
		[activityView startAnimating];
    }
	
    return self;
}

- (void) showAfter:(NSInteger)milis{
	showing = YES;
	
	[self performSelector:@selector(doShow) withObject:self afterDelay:milis];
}

- (void) doShow{
	@synchronized(self){
		if (showing){
			[self show];
		}
	}
	
	
	
}

- (void) close
{
	@synchronized(self){
		showing = NO;
		[self dismissWithClickedButtonIndex:0 animated:YES];
	}
	
}

- (void) dealoc
{
	[activityView release];
	[super dealloc];
}

@end